package ferp.core.ai.nn.activation;

import java.io.Serializable;

/**
* User: igorgok
* Date: 12/2/13 3:40 PM
*/
public interface Activation extends Serializable
{
/*
  // Important: this adapter will not work for Linear activation as it has data fields
  public class Adapter implements JsonSerializer<Activation>, JsonDeserializer<Activation>
  {
    @Override
    public JsonElement serialize(Activation activation, Type type, JsonSerializationContext jsonSerializationContext)
    {
      return new JsonPrimitive(activation.getClass().getSimpleName());
    }

    @Override
    public Activation deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException
    {
      String name = ((Class)type).getName();

      try
      {
        return (Activation)Class.forName(name.substring(0, name.lastIndexOf('.') + 1) + jsonElement.getAsString()).newInstance();
      }
      catch (IllegalAccessException e)
      {
        return null;
      }
      catch (InstantiationException e)
      {
        return null;
      }
      catch (ClassNotFoundException e)
      {
        return null;
      }
    }
  }
*/

  double activate(double d);
  double derivative(double d);
}
